package com.example.young.peopleaccommodationms;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;

public class FirstActivity extends BaseActivity {

    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);

        Log.d("FirstActivity", this.toString());

        button = (Button) findViewById(R.id.first_activity_btn);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent = new Intent(FirstActivity.this, SecondActicity.class);
//                startActivity(intent);
//                启动另一个活动，并将参数作为另一个活动所需的参数
//                SecondActicity.actionStart(FirstActivity.this,"data1","data2");

//              实现Dialog功能code
//                AlertDialog.Builder dialog = new AlertDialog.Builder(FirstActivity.this);
//                dialog.setTitle("This is a dialog");
//                dialog.setMessage("Something you should notice");
//                dialog.setCancelable(true);
//                dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//
//                    }
//                });
//                dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialog, int which) {
//
//                    }
//                });
//                dialog.show();

                //实现fragment
                Intent intent = new Intent(FirstActivity.this, FragmentTest.class);
                startActivity(intent);
            }

        });

    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.d("FirstActivity", "onRestart");
    }
}
